package com.ruoyi.common.oms.dao;

import com.ruoyi.common.oms.entity.YytOmsOrderItem;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.ruoyi.common.pms.entity.YytPmsSkuInfo;
import com.ruoyi.vo.GroupPayInfoListVo;
import org.apache.ibatis.annotations.*;
import org.springframework.stereotype.Repository;

import java.util.List;
import java.util.Map;

/**
 * <p>
 * 订单项信息 Mapper 接口
 * </p>
 *
 * @author huangshun
 * @since 2021-12-16
 */
@Repository
public interface YytOmsOrderItemMapper extends BaseMapper<YytOmsOrderItem> {

    /**
     * 根据订单id获取订单项列表
     */
    @Select("select * from yyt_oms_order_item where order_id = #{orderId}")
    List<YytOmsOrderItem> listByOrderId(@Param("orderId") String orderId);

    /**
     * 根据订单id获取订单项列表 级联店铺对象
     */
    @Select("select * from yyt_oms_order_item where order_id = #{orderId} order by shop_id")
    @Results({
            @Result(property = "shop", column = "shop_id", one = @One(select = "com.ruoyi.common.pms.dao.YytShopMapper.selectById"))
    })
    List<YytOmsOrderItem> getItemList(@Param("orderId") String orderId);


    /**
     * 根据订单号和用户id 获取订单类型
     * @param orderId
     * @param memberId
     * @return
     */
    Integer getOrderInfoType(String orderId, String memberId);

    Map cartNumAndMoney(@Param("memberId") String memberId);

    YytPmsSkuInfo getSkuHotSale();

    List<YytOmsOrderItem> getBuyIsStatus(@Param("memberId") String memberId, @Param("skuId") String skuId);

    List<GroupPayInfoListVo> getBuyUserList(String skuId);
}
